import request from '@/utils/request'

export function fetchStandardTree() {
  return request({
    url: '/standard/tree',
    method: 'get'
  })
}

export function fetchStandardList(query) {
  return request({
    url: '/standard/list',
    method: 'get',
    params: query
  })
}

export function fetchStandard(id) {
  return request({
    url: '/standard',
    method: 'get',
    params: { id: id }
  })
}

export function createStandard(data) {
  return request({
    url: '/standard',
    method: 'post',
    data: data
  })
}

export function updateStandard(data) {
  return request({
    url: '/standard',
    method: 'put',
    data: data
  })
}

export function deleteStandard(id) {
  return request({
    url: '/standard',
    method: 'delete',
    data: { id: id }
  })
}

export function createStandardItem(data) {
  return request({
    url: '/standard/item',
    method: 'post',
    data: data
  })
}

export function updateStandardItem(data) {
  return request({
    url: '/standard/item',
    method: 'put',
    data: data
  })
}

export function fetchStandardItem(id) {
  return request({
    url: '/standard/item',
    method: 'get',
    params: { id: id }
  })
}

export function fetchStandardItemList(query) {
  return request({
    url: '/standard/item/list',
    method: 'get',
    params: query
  })
}

export function deleteStandardItem(id) {
  return request({
    url: '/standard/item',
    method: 'delete',
    data: { id: id }
  })
}